﻿using Albatross.WPF.Common.ViewModels;
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Albatross.SharePoint.Explorer.ViewModels {
	public class WebViewModel : ClientObjectViewModel{
		public WebViewModel(ClientContext context, string name,  Web web) : base(context, name, web) { }

		Web Web { get { return (Web)ClientObject; } }

		public override string GetTreeItemTitle() {
			if (Name == string.Empty) {
				return Web.Title;
			} else {
				return string.Format("{0} ({1})", Name, Web.Title);
			}
		}

		public override IEnumerable<string> SkippedProperties { get { return new string[] { "PushNotificationSubscribers" }; } }

		public override string GetContentTitle() {
			if (Name == string.Empty) {
				return Web.Title;
			} else {
				return string.Format("{0} ({1} - {2})", Name, Web.Title, Web.ServerRelativeUrl);
			}
		}
	}
}